package com.capinfo.accounting.web;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.capinfo.accumulation.model.accounting.Kmszjbsj;
import com.capinfo.accumulation.service.accounting.FzhsxmjbsjService;
import com.capinfo.accumulation.service.accounting.FzlxszService;
import com.capinfo.accumulation.service.accounting.mybits.DICTIONARY_PZLBServiceI;
import com.capinfo.accumulation.service.accounting.mybits.FZLXJBSJServiceI;
import com.capinfo.accumulation.service.accounting.mybits.HZJZPZServiceI;
import com.capinfo.accumulation.service.accounting.mybits.KMSZJBSJServiceI;
import com.capinfo.framework.model.dictionary.Dictionary;
import com.google.gson.Gson;
@Controller
@RequestMapping("/business/accounting/combobox")
public class ComboboxController {
	@Autowired
	HZJZPZServiceI hZJZPZService;
	@Autowired
	DICTIONARY_PZLBServiceI dICTIONARY_PZLBServiceI;
	@Autowired
	FzhsxmjbsjService fzhsxmjbsjService;
	@Autowired
	FzlxszService fzlxszService;
	@Autowired
	FZLXJBSJServiceI fZLXJBSJServiceI;
	@Autowired
	KMSZJBSJServiceI kmszjbsjservicei;
	/**
	 * 财务账套
	 * @param 
	 * @return JSon
	 */

	@RequestMapping(value="/cwzt")  
	@ResponseBody  
	public void cwzt (HttpServletRequest request,HttpServletResponse response) throws IOException  {
		response.setHeader("Content-type", "text/html;charset=UTF-8");
		response.setCharacterEncoding("UTF-8");
		 Gson gson = new Gson();
		   Map map = new HashMap();
		   List<Map<String,Object>>cwzt= hZJZPZService.cwzt();
		   PrintWriter pw;
		   pw = response.getWriter();
		   pw.write(gson.toJson(cwzt));
	   }
	/**
	 * 核算单位
	 * @param 
	 * @return JSon
	 */
	@RequestMapping(value="/hsdw")  
	@ResponseBody  
	public void hsdw (HttpServletRequest request,HttpServletResponse response) throws IOException  {
		response.setHeader("Content-type", "text/html;charset=UTF-8");
		response.setCharacterEncoding("UTF-8");
		 Gson gson = new Gson();
		   Map map = new HashMap();
		   List<Map<String,Object>>hsdw= hZJZPZService.hsdw();
		   PrintWriter pw;
		   pw = response.getWriter();
		   pw.write(gson.toJson(hsdw));
	   }
	/**
	 * 凭证类别
	 * @param 
	 * @return JSon
	 */
	@RequestMapping(value="/pzlb")  
	@ResponseBody  
	public void pzlb (HttpServletRequest request,HttpServletResponse response) throws IOException  {
		response.setHeader("Content-type", "text/html;charset=UTF-8");
		response.setCharacterEncoding("UTF-8");
		 Gson gson = new Gson();
		   Map map = new HashMap();
		   List<Map<String,Object>>pzlb= dICTIONARY_PZLBServiceI.pzlb();
		   PrintWriter pw;
		   pw = response.getWriter();
		   pw.write(gson.toJson(pzlb));
	   }
	/**
	 * 会计年度
	 * @param 
	 * @return JSon
	 */
	@RequestMapping(value="/KjndSel")  
	@ResponseBody  
	public List KjndSel (HttpServletRequest request,HttpServletResponse response) throws IOException  {
		   Map map = new HashMap();
		   List<Map<String,Object>>KjndSel= kmszjbsjservicei.KjndSel(map);
		   return KjndSel;
	   }
	
	/**
	 * 科目属性
	 * @param 
	 * @return JSon
	 */
	@RequestMapping(value="/KmsxSel")  
	@ResponseBody  
	public List KmsxSel (HttpServletRequest request,HttpServletResponse response) throws IOException  {
		   Map map = new HashMap();
		   List<Map<String,Object>>KmsxSel= kmszjbsjservicei.KmsxSel(map);
		return KmsxSel;
	   }
	

	/**
	 * 台账标记
	 * @param 
	 * @return JSon
	 */
	@RequestMapping(value="/TzbjSel")  
	@ResponseBody  
	public List TzbjSel (HttpServletRequest request,HttpServletResponse response) throws IOException  {
		   Map map = new HashMap();
		   List<Map<String,Object>>TzbjSel= kmszjbsjservicei.TzbjSel(map);
		return TzbjSel;
	   }
	
	/**
	 * 日记账类型
	 * @param 
	 * @return JSon
	 */
	@RequestMapping(value="/RjzlxSel")  
	@ResponseBody  
	public List RjzlxSel (HttpServletRequest request,HttpServletResponse response) throws IOException  {
		   Map map = new HashMap();
		   List<Map<String,Object>>RjzlxSel= kmszjbsjservicei.RjzlxSel(map);
		return RjzlxSel;
	   }
	/**
	 * 财务科目
	 * @param 
	 * @return JSon
	 */
	@RequestMapping({ "/cwkm.shtml" })
	@ResponseBody
	public void cwkm(HttpServletRequest request,HttpServletResponse response) throws IOException {
		response.setHeader("Content-type", "text/html;charset=UTF-8");
		response.setCharacterEncoding("UTF-8");
		List<Kmszjbsj>  kmszList =  fzhsxmjbsjService.findKmsz();
		PrintWriter pw;
		pw = response.getWriter();
		pw.write(JSON.toJSONString(kmszList));
	}
	/**
	 * 核算类型
	 * @param 
	 * @return JSon
	 */
	
	@RequestMapping(value="/hslx")  
	@ResponseBody  
	public void hslb (HttpServletRequest request,HttpServletResponse response) throws IOException  {
		response.setHeader("Content-type", "text/html;charset=UTF-8");
		response.setCharacterEncoding("UTF-8");
		 Gson gson = new Gson();
		   Map map = new HashMap();
		   List<Map<String,Object>>hslx= fZLXJBSJServiceI.hslx();
		   PrintWriter pw;
		   pw = response.getWriter();
		   pw.write(gson.toJson(hslx));
	   }
}
